﻿namespace NEvoWeb.Modules.NB_Store
{
    using System;
    using System.Collections.Specialized;
    using System.Runtime.InteropServices;
    using System.Xml;

    public class GenXMLReplace
    {
        private NameValueCollection Inputs = new NameValueCollection();

        public void AddNodeReplacement(string XPath, string value, bool cdata = true)
        {
            if (cdata)
            {
                value = "<![CDATA[" + value + "]]>";
            }
            this.Inputs.Add(XPath, value);
        }

        public string DoNodeReplacement(string XMLinfo)
        {
            int num=0;
            XmlDataDocument xmlDoc = new XmlDataDocument();
            xmlDoc.LoadXml(XMLinfo);
            int num3 = num + 1;
            int num2 = this.Inputs.Keys.Count - 1;
            for (num = 0; ((num3 >> 0x1f) ^ num) <= ((num3 >> 0x1f) ^ num2); num += num3)
            {
                SharedFunctions.ReplaceXMLNode(xmlDoc, this.Inputs.Keys[num], this.Inputs[this.Inputs.Keys[num]], true);
            }
            return xmlDoc.OuterXml;
        }
    }
}

